package com.office.forum.manage.category.service.impl;

import java.util.List;
import com.office.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.office.forum.manage.category.mapper.ForumPostCategoryMapper;
import com.office.forum.manage.category.domain.ForumPostCategory;
import com.office.forum.manage.category.service.IForumPostCategoryService;

/**
 * 帖子分类Service业务层处理
 * 
 * @author ruoyi
 * @date 2025-05-31
 */
@Service
public class ForumPostCategoryServiceImpl implements IForumPostCategoryService 
{
    @Autowired
    private ForumPostCategoryMapper forumPostCategoryMapper;

    /**
     * 查询帖子分类
     * 
     * @param categoryId 帖子分类主键
     * @return 帖子分类
     */
    @Override
    public ForumPostCategory selectForumPostCategoryByCategoryId(Long categoryId)
    {
        return forumPostCategoryMapper.selectForumPostCategoryByCategoryId(categoryId);
    }

    /**
     * 查询帖子分类列表
     * 
     * @param forumPostCategory 帖子分类
     * @return 帖子分类
     */
    @Override
    public List<ForumPostCategory> selectForumPostCategoryList(ForumPostCategory forumPostCategory)
    {
        return forumPostCategoryMapper.selectForumPostCategoryList(forumPostCategory);
    }

    /**
     * 新增帖子分类
     * 
     * @param forumPostCategory 帖子分类
     * @return 结果
     */
    @Override
    public int insertForumPostCategory(ForumPostCategory forumPostCategory)
    {
        forumPostCategory.setCreateTime(DateUtils.getNowDate());
        return forumPostCategoryMapper.insertForumPostCategory(forumPostCategory);
    }

    /**
     * 修改帖子分类
     * 
     * @param forumPostCategory 帖子分类
     * @return 结果
     */
    @Override
    public int updateForumPostCategory(ForumPostCategory forumPostCategory)
    {
        return forumPostCategoryMapper.updateForumPostCategory(forumPostCategory);
    }

    /**
     * 批量删除帖子分类
     * 
     * @param categoryIds 需要删除的帖子分类主键
     * @return 结果
     */
    @Override
    public int deleteForumPostCategoryByCategoryIds(Long[] categoryIds)
    {
        return forumPostCategoryMapper.deleteForumPostCategoryByCategoryIds(categoryIds);
    }

    /**
     * 删除帖子分类信息
     * 
     * @param categoryId 帖子分类主键
     * @return 结果
     */
    @Override
    public int deleteForumPostCategoryByCategoryId(Long categoryId)
    {
        return forumPostCategoryMapper.deleteForumPostCategoryByCategoryId(categoryId);
    }
}
